package com.my.study.springframework.test.proxy.cglib;

import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;

import java.lang.reflect.Method;

/**
 * 增强被代理对象属性
 *
 * CGLIB实现原理是继承被代理类，所有增强的方法是要能重写的！！！
 *
 * @author: yidujun
 * @create: 2021/07/13 14:50
 */
public class MoneyMethodEnhancer implements MethodInterceptor {

    @Override
    public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable {
        System.out.println("===================中彩票500W================");
        Object object = proxy.invokeSuper(obj, args);
        System.out.println("===================中彩票20000w================");
        return object;
    }
}
